<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<div id="projectWizard" class="wizard box tabbedBox no-border">
	<div class=" header">
		<ul class="steps">
			<li><a class="current" href="#wiz_basicInfo">基本信息</a>
			</li>
			<li><a href="#wiz_service">服务范围</a>
			</li>
			<li><a href="#wiz_member">人力资源计划</a>
			</li>
			<li><a href="#wiz_plan">实施计划</a>
			</li>
			<li><a href="#wiz_cost">项目预算</a>
			</li>
			<li><a href="#wiz_quality">服务质量</a>
			</li>
		</ul>
	</div>
	<div style="padding:0" class="content tabbed">
		<div id="wiz_basicInfo">
			<div class="header">
				<h2>1.基本信息</h2>
			</div>
			<form:form id="formProjectBasicInfo" commandName="model"
				action="project/project/save">
				<form:hidden path="id" />
				<table class="form-table">
					<tr>
						<td class="td1">项目名称：</td>
						<td class="td2" colspan="3">${model.name }</td>

					</tr>
					<tr>


						<td class="td1">项目编号：</td>
						<td class="td2">${model.code }</td>
						<%-- <td class="td1">项目级别：</td>
						<td class="td2">${model.projectLevel }</td> --%>
					</tr>

					<tr>
						<td class="td1">项目类型：</td>
						<td class="td2">${model.projectType }</td>
						<td class="td1">合同编号：</td>
						<td class="td2">${model.contractNo }</td>
					</tr>
					<tr>
						<td class="td1">项目经理：</td>
						<td class="td2">${model.managerName }</td>

						<td class="td1">销售：</td>
						<td class="td2">${model.sellerName }</td>
					</tr>
					<tr>
						<td class="td1">项目起止日期：</td>
						<td class="td2"><fmt:formatDate value="${model.startDate }"
								pattern="yyyy-MM-dd" />到<fmt:formatDate
								value="${model.endDate }" pattern="yyyy-MM-dd" /></td>
						<td class="td1">项目状态：</td>
						<td class="td2">${model.status }</td>
					</tr>
					<tr>
						<td class="td1">项目金额：</td>
						<td class="td2">${model.account }(元)</td>
						<td class="td1">工作日历：</td>
						<td class="td2" colspan="3">${appCalendarConfigName}</td>

					</tr>

					<tr>
						<td class="td1">备注：</td>
						<td class="td2" colspan="3">${model.memo }</td>
					</tr>


					<tr>
						<td class="td1">附件：
						<td class="td2" colspan="3">(附件包括本项目的招标文件、投标文件、合同等相关文档)<br />
							<isperp:uploader readonly="true" sourceId="${model.id }"
								id="projectFiles"></isperp:uploader>
						</td>
					</tr>

					<tr>
						<td class="td1">项目配置项描述：</td>
						<td class="td2" colspan="3">${model.confDescription }</td>
					</tr>


					<tr>
						<td class="td1">客户名称：</td>
						<td class="td2">${model.cusCustomerName }</td>
						<td class="td1">邮箱：</td>
						<td class="td2">${model.customerEmail }</td>
					</tr>
					<tr>
						<td class="td1">联系人：</td>
						<td class="td2">${model.customerLinkman }</td>
						<td class="td1">联系电话：</td>
						<td class="td2">${model.customerLinktel }</td>
					</tr>
					<tr>

						<td class="td1">项目地址：</td>
						<td class="td2" colspan="3">${model.projectAddress }</td>
					</tr>
				</table>
			</form:form>
		</div>

		<div id="wiz_service">
			<div id="wiz_service_content">
				<div style="width:100%;">
					<isperp:grid
						url="project/service/listDetail?projectId=${model.id }"
						gridTitle="已选服务目录" gridId="serviceGrid" pager="servicePager"
						idFieldName="id" showSearchbar="false" showPager="false"
						width="auto" cusFormatterActions="true" multiselect="false"
						showToolbar="false" cusViewUrl="serviceCatalog/service/view">
						<jsp:body>
					<isperp:column name="id" title="id" hidden="true"></isperp:column>
			
					<isperp:column name="code" title="编号" width="100">
					</isperp:column>
					<isperp:column name="name" title="名称" width="200">
					</isperp:column>
					<isperp:column name="service_way" title="服务方式" width="140">
					</isperp:column>
					<isperp:column name="service_response" title="服务响应" width="140">
					</isperp:column>
					</jsp:body>
					</isperp:grid>
				</div>
			</div>
		</div>
		<div id="wiz_member"></div>

		<div id="wiz_plan"></div>

		<div id="wiz_cost" style="min-height: 280px"></div>
		<div id="wiz_quality"></div>
	</div>
	<isperp:wizButtonList buttonListId="bpmConfigWizardBtns"
		hiddenFinishButton="true">
		<isperp:processButtons processKey="projectProcess"
			processId="${model.processId }" businessKey="${model.id }"
			formId="formProjectBasicInfo"></isperp:processButtons>
	</isperp:wizButtonList>
</div>
<div id="createCusDialog" title="创建用户"
	style="display:none;padding:5px;-webkit-overflow-scrolling:touch; overflow:auto;">
	<iframe id="createCusIframe" src=""
		style="width:100%;height:100%;;border:none"></iframe>
</div>
<script type="text/javascript">
	var createCusUserDlg = $("#createCusDialog").dialog({
		modal : true,
		autoOpen : false,
		width : 500,
		height : 500,
		open : function(event, ui) {
			$("#createCusUserId").val("");
		},
		buttons : {
			保存 : function() {
				var $me = $(this);
				isperp.getWindow("createCusIframe").sumbitCusForm(function(id, name) {
					$("#cusCustomerId").val(id);
					$("#customerSelector").val(name);
					$me.dialog("close");
				});
			}
		}
	});

	//新增客户
	function openCreateCus(isNew) {
		var title;
		if (isNew) {
			title = "创建";
			$("#createCusIframe").attr("src", "customer/customer/edit?hideBtn=true");
		} else {
			title = "更新";
			var cusCustomerId = $("#cusCustomerId").val();
			$("#createCusIframe").attr("src", "customer/customer/edit?hideBtn=true&id=" + cusCustomerId);
		}

		createCusUserDlg.dialog({
			title : title
		});
		createCusUserDlg.dialog("open");

	}

	function submitForm(afterSuccess) {
		return isperp.submitForm({
			formId : "formProjectBasicInfo",
			success : function(data, textStatus, jqXHR) {

			}
		});
	}

	var projectWizard = isperp.wizard({
		wizardId : "projectWizard"
	});

	var projectWizard_Event0 = function(index, obj) {

	};

	var projectWizard_Event1 = function(index, obj) {

		/* var result = submitForm();
		if (result == false) {
			return false;
		}

		$("#wiz_service_content").empty().load("project/project/scopeOfService?projectId=${model.id}", function() {
			isperp.setEditor("projConfDescription");
		}); */

	};

	var projectWizard_Event2 = function(index, obj) {

		$("#wiz_member").empty().load("project/project/member?projectId=${model.id}");

	};

	var projectWizard_Event3 = function(index, obj) {

		$("#wiz_plan").empty().load("project/project/plan?projectId=${model.id}");
	};
</script>


<script type="text/javascript">
	var projectWizard_Event4 = function(index, obj) {
		$("#wiz_cost").empty().load("project/project/cost?projectId=${model.id}");
	};
	var projectWizard_Event5 = function(index, obj) {
		var costTemplateId = $("#projCostTemplateId").val();

		if (costTemplateId) {

			isperp.submitForm({
				formId : "formProjectCostItem",
				success : function(data, textStatus, jqXHR) {

				}
			});

		}

		$("#wiz_quality").empty().load("project/project/quality?projectId=${model.id}");
	};
</script>

